#include <stdio.h>

int main(void)
{
    int a, n;
    printf("Please input a:");
    scanf("%d", &a);
    printf("Please input n:");
    scanf("%d", &n);

    int i, j;
    long num = 0, sum = 0;
    printf("Sum=");
    for (i = 1, j = 1; i <= n; i++, j = j * 10)
    {
        num = num + a * j;
        printf("%ld", num);
        if (i < n) printf("+");
        sum += num;
    }
    printf("\nSum=%ld", sum);
    return 0;
}
